<?php require '../public/system/headers/headers.php';?>
<?php echo $this->headLink()->appendStylesheet($this->websiteUrl . 'system/css/seotoaster.css'); ?>
<?php echo $this->headLink()->appendStylesheet($this->websiteUrl .'system/js/thickbox/thickbox.css'); ?>
<?php $this->headScript()->appendFile($this->websiteUrl . 'system/js/jquery/jquery.js'); ?>
<?php $this->headScript()->appendFile($this->websiteUrl . 'system/js/thickbox/thickbox.js'); ?>
<?php echo $this->headScript(); ?>
<script type="text/javascript">
function loadImages(folder)
{
    $.ajax({
        type : 'POST',
        url : '<?php echo $this->websiteUrl; ?>sys/backend_shopping/loadimages/',
        data : {folder : folder},
        success : function(data) {
            var obj = eval('('+data+')');
            $('#list_images').html(obj.small.replace(/shop./g, ''));
            $('#list_images').show('700');
        }
    });
}
function selectImage(path)
{
    src = path.replace('<?php echo $this->websiteUrl; ?>', '');
    $('#company-logo').val(src);
    $('.logo').attr('src', path);
    $('#list_images').hide('700');
}
</script>
<div id="seotoaster" class="shoppingconfig">
<div class="admineditwhat">{%Shopping cart configuration%} </div>
<div class="close_window" onclick="parent.tb_remove();"></div>
<?php if ($this->update) : ?>
<div id="message" class="errors" style="background-color:green;" onclick="this.style.display='none';">{%Configuration updated%}.</div>
<?php endif; ?>
<div id="list_images"></div>
<form action="<?php echo $this->websiteUrl; ?>sys/backend_shopping/config/" name="saveconfig" id="saveconfig" method="post" enctype="multipart/form-data">
    <div class="block1">
        <fieldset><legend>{%Business Information%}</legend>
        <p><label>{%Company%}:</label><input type="text" value="<?php echo $this->shoppingConfig['company']; ?>" name="company" id="company" /></p>
        <p><label>{%Address%}:</label><input type="text" value="<?php echo $this->shoppingConfig['address']; ?>" name="address" id="address" /></p>
        <p><label>{%Phone%}:</label><input type="text" value="<?php echo $this->shoppingConfig['phone']; ?>" name="phone" id="phone" /></p>
        <p><label>{%Email%}:</label><input type="text" value="<?php echo $this->shoppingConfig['email']; ?>" name="email" id="email" /></p>
        </fieldset>
		<fieldset><legend>{%Payment%}</legend>
        <p><label>{%Currency%}: </label>
            <select name="currency" id="currency">
            <option value="USD"<?php echo ($this->shoppingConfig['currency']=='USD'?' selected="selected"':''); ?>>USD</option>
            <option value="AUD"<?php echo ($this->shoppingConfig['currency']=='AUD'?' selected="selected"':''); ?>>AUD</option>
            <option value="BRL"<?php echo ($this->shoppingConfig['currency']=='BRL'?' selected="selected"':''); ?>>BRL</option>
            <option value="GBP"<?php echo ($this->shoppingConfig['currency']=='GBP'?' selected="selected"':''); ?>>GBP</option>
            <option value="CAD"<?php echo ($this->shoppingConfig['currency']=='CAD'?' selected="selected"':''); ?>>CAD</option>
            <option value="CZK"<?php echo ($this->shoppingConfig['currency']=='CZK'?' selected="selected"':''); ?>>CZK</option>
            <option value="DKK"<?php echo ($this->shoppingConfig['currency']=='DKK'?' selected="selected"':''); ?>>DKK</option>
            <option value="EUR"<?php echo ($this->shoppingConfig['currency']=='EUR'?' selected="selected"':''); ?>>EUR</option>
            <option value="HKD"<?php echo ($this->shoppingConfig['currency']=='HKD'?' selected="selected"':''); ?>>HKD</option>
            <option value="HUF"<?php echo ($this->shoppingConfig['currency']=='HUF'?' selected="selected"':''); ?>>HUF</option>
            <option value="ILS"<?php echo ($this->shoppingConfig['currency']=='ILS'?' selected="selected"':''); ?>>ILS</option>
            <option value="JPY"<?php echo ($this->shoppingConfig['currency']=='JPY'?' selected="selected"':''); ?>>JPY</option>
            <option value="MXN"<?php echo ($this->shoppingConfig['currency']=='MXN'?' selected="selected"':''); ?>>MXN</option>
            <option value="NZD"<?php echo ($this->shoppingConfig['currency']=='NZD'?' selected="selected"':''); ?>>NZD</option>
            <option value="NOK"<?php echo ($this->shoppingConfig['currency']=='NOK'?' selected="selected"':''); ?>>NOK</option>
            <option value="PHP"<?php echo ($this->shoppingConfig['currency']=='PHP'?' selected="selected"':''); ?>>PHP</option>
            <option value="PLN"<?php echo ($this->shoppingConfig['currency']=='PLN'?' selected="selected"':''); ?>>PLN</option>
            <option value="SGD"<?php echo ($this->shoppingConfig['currency']=='SGD'?' selected="selected"':''); ?>>SGD</option>
            <option value="SEK"<?php echo ($this->shoppingConfig['currency']=='SEK'?' selected="selected"':''); ?>>SEK</option>
            <option value="CHF"<?php echo ($this->shoppingConfig['currency']=='CHF'?' selected="selected"':''); ?>>CHF</option>
            <option value="TWD"<?php echo ($this->shoppingConfig['currency']=='TWD'?' selected="selected"':''); ?>>TWD</option>
            <option value="THB"<?php echo ($this->shoppingConfig['currency']=='THB'?' selected="selected"':''); ?>>THB</option>
            </select>
        </p>
        <p><label>{%Tax%}: </label><input type="text" name="tax" id="tax" value="<?php echo $this->shoppingConfig['tax']; ?>" /></p>
        <p><label>{%Gateway%}: </label>
            <select name="gateway" id="gateway" onchange="if(this.options[this.selectedIndex].value == ''){this.form.quote.checked=true;document.getElementById('settingsforpaypal').style.display='none';}else{this.form.quote.checked=false;document.getElementById('settingsforpaypal').style.display='block';}">
            <option value=""<?php echo ($this->shoppingConfig['gateway']==''?' selected="selected"':''); ?>>select</option>
            <option value="paypal"<?php echo ($this->shoppingConfig['gateway']=='paypal'?' selected="selected"':''); ?>>PayPal</option>
            </select>
        </p>
        <p><label>{%Quote%}:</label>
            <input type="checkbox" readonly="readonly" name="quote" id="quote" style="float:right;margin-right:5px;" <?php echo ($this->shoppingConfig['quote']=='1'?'checked="checked"':''); ?> />
        </p>
		 </fieldset>
          <div id="settingsforpaypal" <?php echo $this->shoppingConfig['gateway']=='paypal'?'style="display:block;height:325px;"':''; ?>>
            <fieldset><legend>{%Paypal Settings%}</legend>
            <?php $settingsPayPal = unserialize($this->shoppingConfig['paypal']); ?>
            <p><label>{%Email%}:</label> <input type="text" name="paypalemail" id="paypalemail" value="<?php echo $settingsPayPal['email']; ?>" /></p>
            <p><label>{%API Signature%}:</label> <input type="text" name="paypalsignature" id="paypalsignature" value="<?php echo $settingsPayPal['signature']; ?>"/></p>
            <p><label>{%API User%}:</label> <input type="text" name="paypaluser" id="paypaluser" value="<?php echo $settingsPayPal['user']; ?>" /></p>
            <p><label>{%API Password%}:</label> <input type="text" name="paypalpassword" id="paypalpassword" value="<?php echo $settingsPayPal['password']; ?>" /></p>
   		  </fieldset>
	      </div>
    </div>

    <div class="block2">
    	<fieldset style="height:80px;"><legend>{%Company Logo%}</legend>
            <select id="image_folders" style="width:150px;" onchange="loadImages(this.options[this.selectedIndex].value);">
                <option value="" selected="selected">select folder</option>
                <?php if(!empty($this->listFolders) && is_array($this->listFolders)): ?>
                    <?php foreach($this->listFolders as $folderName): ?>
                     <option value="<?php echo trim($folderName); ?>"><?php echo $folderName; ?></option>
                    <?php endforeach; ?>
                <?php endif; ?>
            </select>
            <input type="hidden" name="company-logo" id="company-logo"  value="<?php echo $this->shoppingConfig['company_logo']; ?>" />
        <img src="<?php echo $this->logoCompany !='' ? $this->logoCompany : $this->websiteUrl.'system/images/noimage.png'; ?>" alt="<?php echo $this->logoCompany; ?>" class="logo" border="0">
        </fieldset>
		
        <fieldset><legend>{%Display templates%}</legend>
        <div style="float:left;width:100%; margin:5px 0px; position:relative;">
         <span style="float:right;cursor:pointer;font-weight:bold;margin-right:5px;" onclick="document.getElementById('info').style.display='block';">{%help%}</span>
        <!-- Hidden help div -->
        <div id="info" onclick="this.style.display='none';">
            <div>
                <p>{photo} - {%photo%}</p>
                <p>{name} - {%name%}</p>
                <p>{price} - {%price%}</p>
                <p>{itemid} {%itemID%}</p>
                <p>{addtocart} - {%add to cart%} </p>
                <p>{zoomimage} - {%zoom image%}</p>
                <p>{editproduct} - {%edit product%}</p>
            </div>
            <div>
                <p>{description} - {%description%}</p>
                <p>{options} - {%Option name : option,option,etc%}.</p>
                <p>{related} - {%related products%}</p>
                <p>{categories} - {%categories%}</p>
                <p>{url} - {%Product page url%}</p>
            </div>
        </div>
        <!--  end Hidden help div -->

        <p><label>{%Template for product Page%}:</label></p>
        <textarea name="template-product" id="template-product" ><?php echo $this->shoppingConfig['template_product']; ?></textarea>
        </div>
        <div style="float:left;width:100%; margin:5px 0px;">
            <p><label>{%Template for product listings%}:</label>
            <p><textarea name="template-prod-list" id="template-prod-list"><?php echo $this->shoppingConfig['template_prod_list']; ?></textarea></p>
        </div>
        </fieldset>

    </div><!--  end block2 div -->
   	<input type="submit" name="submit" value="{%Save%}" class="formsubmit"/>

</form>

</div>